<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form class="layui-form" lay-filter="nnewForm" id="add_nnew_form" action="" style="padding:15px 10px;">
    <input type="hidden" name="newid">
    <div class="layui-form-item">
        <label class="layui-form-label">标题：</label>
        <div class="layui-input-block">
            <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">发表类型：</label>
        <div class="layui-input-block" >
            <select name="publishTypeId" id="publishTypeId"  xm-select-radio=""  xm-select-search="" xm-select="roles2" xm-select-direction="down">
                <option value="-1">请选择</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">帖子状态：</label>
        <div class="layui-input-block" >
            <select name="stateid" id="stateid"  xm-select-radio=""  xm-select-search="" xm-select="roles2" xm-select-direction="down">
                <option value="-1">请选择</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">新闻内容：</label>
        <div class="layui-input-block" >
            <textarea id="content" name="content" style="display: none;"></textarea>
        </div>
    </div>


    <script>
        layui.form.render();

        layui.layedit.build('content'); //建立编辑器

        $.get("${path}/nnew/getType",function(data){
            $.each(data,function(){
                var opt = $("<option></option>").appendTo("#publishTypeId");
                opt.text(this.typeName).val(this.typeid);
            });
            layui.form.render()
        });

        $.get("${path}/nnew/getState",function(data){
            $.each(data,function(){
                var opt = $("<option></option>").appendTo("#stateid");
                opt.text(this.stateName).val(this.stateid);
            });
            layui.form.render()
        });

    </script>
</form>
</body>
</html>
